import Vue from 'vue'
import Vuex from 'vuex'
import axios from '../http/http'
Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    user:{
      userImg:'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png',
      userName:'东哥牛皮'
    },
    tableData:[]
  },
  mutations: {
    tableMutations(state,obj){
      state.tableData = obj
    }
  },
  actions: {
    selectTableData({commit},obj) {
      return axios({
        url: obj.url,
        params: obj.params,
        methods: 'get'
      }).then(res => {
        if(res.data.code === 0){
          commit('tableMutations',res.data)
        }
      })
    }
  },
  modules: {

  }
})
